from flask import Flask, request

app = Flask(__name__)
"""
执行顺序
会有一个数组
before_request = ['xxxx1', 'xxxx2']
执行时候直接遍历
"""
@app.before_request
def check_login():
    if request.path == '/login':
        pass
        # return None
    elif request.path == '/index':
        return 'login'

@app.route('/login', methods=['GET', 'POST'])
def login():
    print("视图函数x1")
    return "Login"

@app.route('/index', methods=['GET', 'POST'])
def index():
    print("视图函数x2")
    return "index"


if __name__ == '__main__':
    app.run()